Skip to content

fix(id/artifact): grandfather duplicate-after and non-NFC shapes in local replay only (#5625) - #6321

Merged
dezren39 merged 1 commit into
mainfrom
queue/10598-5625-legacy-replay-boundary
Nov 5, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/10598-5625-legacy-replay-boundary

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Fixes #5625. Queue task 10598 (receipt-audit follow-up from #3232 / design #3231).

Problem

Two receipt rules added after artifacts were already being written — the duplicate-after frontier rule (#3196) and the NFC rules for document.media_type / tag.name / tag.value (#3192) — were enforced unconditionally on local replay. ArtifactLog::open re-runs verify() (which always checked duplicate after) and parsed_for_replay() (which still checked the NFC fields), so a pre-upgrade log the producer path legitimately wrote could no longer be reopened, contrary to #3231's replay-compatibility criterion.

Change (narrowly scoped, trusted local replay boundary)

  • SignedArtifact::verify_for_replay() (new, pub(crate)): the replay twin of verify(), mirroring the existing parsed_for_replay() pattern. check_after_mode skips only the duplicate-after sub-rule in replay mode; the frontier count, well-formed-hash rules, and all authenticity checks (hash, signature, canonical author) stay strict in both modes.
  • parsed_mode(replay=true): the three NFC checks (id(artifact): parsed() accepts non-NFC text in document and tag — media_type, tag name and value bypass the NFC rule documents.rs and tag_claims.rs both enforce #3192) are grandfathered in replay only; every other document/tag rule (emptiness, length bounds, subject hash, content size) stays strict in both modes.
  • ArtifactLog::store: the non-frame-check branch — reachable only from open / open_read_only, i.e. trusted local file replay — now uses both replay twins. Fresh receipt and remote receipt go through insert → verify() + parsed() and are unchanged.

#4459 coordination

This leniency is deliberately NOT a remote-receipt policy: artifacts arriving from peers (push/pull, insert) are verified strictly as before, so the #4459 artifact-format cutoff for remote pulls is unaffected. The boundary is exactly "a log this server already holds on disk."

Tests (oracle: producer-era shapes vs fresh shapes)

  • a_legacy_log_with_a_duplicate_after_frontier_still_replays — a validly signed duplicate-after artifact is refused by verify() and insert(), yet open and open_read_only reopen the log containing it; the same log with a forged hash line still fails to reopen in both modes.
  • a_legacy_log_with_non_nfc_document_and_tag_fields_still_replays — non-NFC media_type, tag name, and tag value artifacts are refused by parsed() and insert(), parse under parsed_for_replay(), and reopen via both local paths.
  • Laptop run: full cargo test --lib in pkgs/id — 2258 passed + 317 (id-core) passed, 0 failed. Pre-existing rustfmt drift in unrelated files/lines left alone.

🤖 Queue worker, lane code-s, task 10598.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 17:06
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 22 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e7c1d87f-ebce-497c-b603-f57e400a6c6e
Commits

Reviewing files that changed from the base of the PR and between f56bc54 and f78d717.

Files selected for processing: 1

  • pkgs/id/src/artifact.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T17:08:03.287475Z f78d717 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit c0b4ac6 into main Nov 5, 2026
5 checks passed
@dezren39
dezren39 deleted the queue/10598-5625-legacy-replay-boundary branch November 5, 2026 17:29
@dezren39
dezren39 restored the queue/10598-5625-legacy-replay-boundary branch November 8, 2026 04:07
@dezren39
dezren39 deleted the queue/10598-5625-legacy-replay-boundary branch November 8, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(artifact): preserve pre-upgrade log replay for duplicate after and non-NFC fields

1 participant